home *** CD-ROM | disk | FTP | other *** search
- Path: CARNet.hr!tilia!ov30801
- From: ov30801@tilia.cc.fer.hr (oliver-marin vidovic)
- Newsgroups: comp.lang.c
- Subject: Random Numbers Help Needed
- Date: 7 Feb 1996 14:27:25 GMT
- Organization: CARNet, CROATIA
- Distribution: world
- Message-ID: <4facsd$lch@bagan.srce.hr>
- NNTP-Posting-Host: tilia.cc.etf.hr
- Mime-Version: 1.0
- Content-Type: text/plain; charset=US-ASCII
- Content-Transfer-Encoding: 7bit
- X-Newsreader: TIN [version 1.2 PL2]
-
-
- Hi! I have a problem involving random number generator.
- In my program I need a list of random numbers, but I don't want
- them to be the same every time I start the program. Now, I know I
- have to change the seed by srand function, but if I put the argument
- to be constant, then srand is of no use. Therefore, i came to conclusion
- that i have to make the argument of srand every time different.
- So, my idea was to use the computer clock somehow, and to take
- time as the seed, since that can hardly be the same every time I
- start the program. But, there is something wrong when I try to make
- something with functions from time.h.
- (maybe I don't use them in right way, or maybe the whole idea is wrong)
-
- Is there someone who can help me?!
- Thanks.
-
- --
- ------------------------------------------------------------------ + +
- ---- Oliver M. Vidovic (Jombo) FER (Zagreb, Croatia) ---- +
- ---- e-mail: ov30801@pinus.cc.fer.hr ----------------------------- \___/
-